package cn.xfdzx.android.apps.shop.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

import cn.xfdzx.android.apps.shop.R;

/**
 * @author gzk
 * @date 2020/3/28 0028
 * description：取消订单原因
 */
public class CancelOrderWhyLVAdapter extends BaseAdapter {

    private Context mContext;
    private ArrayList<String> mList;


    private TextView tv_why;
    private ImageView iv_why_dui;

    public CancelOrderWhyLVAdapter(Context mContext, ArrayList<String> mList) {
        this.mContext = mContext;
        this.mList = mList;
        addData();
    }

    private void addData() {

        mList.add("不想买了");
        mList.add("地址选错了");
        mList.add("忘记使用或选错优惠券/红包");
        mList.add("商品买多了/买错了/买漏了");
        mList.add("在线支付遇到问题");

    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return i;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(final int i, View view, ViewGroup viewGroup) {
        view = View.inflate(mContext, R.layout.item_cancel_order_why, null);
        tv_why = view.findViewById(R.id.tv_why);
        iv_why_dui = view.findViewById(R.id.iv_why_dui);

        tv_why.setText(mList.get(i));

        if (i == 0) {
            iv_why_dui.setImageResource(R.drawable.icon_select_address_green);

        }else {
            iv_why_dui.setImageResource(R.drawable.d99999_oval);
        }

        return view;
    }
}
